<template>
<div>
  <template>
    <el-table
        :data="tableData"
        style="width: 100%"
    >
      <el-table-column
          prop="id"
          label="商品id"
          align="center"
      >
      </el-table-column>
      <el-table-column
          prop="goodsName"
          align="center"
          label="商品名称"
      >
      </el-table-column>
      <el-table-column
          prop="inPrice"
          align="center"
          label="进货价格">
      </el-table-column>
      <el-table-column
          prop="outPrice"
          align="center"
          label="销售价格">
      </el-table-column>

      <el-table-column
          prop="goodsType"
          align="center"
          label="商品种类">
      </el-table-column>



      <el-table-column
          prop="goodsNum"
          align="center"
          label="库存剩余">
      </el-table-column>
      <el-table-column
          align="center"
          label="库存状态">
        <template slot-scope="scope2">
            <div v-if="scope2.row.goodsNum<20" style="color: red">库存不足</div>
          <div v-if="scope2.row.goodsNum>=20" style="color:gray">库存充足</div>
        </template>
      </el-table-column>
    </el-table>
  </template>
</div>
</template>

<script>
import axios from 'axios'
export default {
  name: "stock",
  data(){
    return{
      tableData:[],

    }
  },
  mounted() {
    //这里发送库存请求
    axios.get("http://localhost:8088/scan").then(response => {
      this.$set(this, 'tableData', response.data)
    })
  }
}
</script>

<style lang="scss" scoped>



</style>